@using MyCompanyName.AbpZeroTemplate.Localization
<div ng-controller="common.views.auditLogs.index as vm">
    <div class="row margin-bottom-5">
        <div class="col-xs-6">
            <div class="page-head">
                <div class="page-title">
                    <h1>
                        <span>@L("AuditLogs")</span>
                    </h1>
                </div>
            </div>
        </div>
        <div class="col-xs-6 text-right">

        </div>
    </div>
    <div class="portlet light">
        <div class="portlet-body">

            <div class="form">
                <form class="horizontal-form">
                    <div class="form-body" enter-key="vm.getAuditLogs()">

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("DateRange")</label>
                                    <input date-range-picker type="text" options="vm.dateRangeOptions" min="vm.dateRangeOptions.min" max="vm.dateRangeOptions.max" class="form-control date-picker" ng-model="vm.dateRangeModel" />
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("UserName")</label>
                                    <input type="text" class="form-control" ng-model="vm.requestParams.userName">
                                </div>
                            </div>
                        </div>

                        <div class="row" ng-if="vm.advancedFiltersAreShown">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("Service")</label>
                                    <input type="text" class="form-control" ng-model="vm.requestParams.serviceName">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <label class="control-label" style="display: block">@L("Duration")</label>
                                <div class="input-group" style="width: 250px !important;">
                                    <input type="number" only-number="" ng-model="vm.requestParams.minExecutionDuration" class="form-control" min="0" max="86400000" ng-minlength="0" ng-maxlength="8">
                                    <span class="input-group-addon">
                                        ---
                                    </span>
                                    <input type="number" only-number="" ng-model="vm.requestParams.maxExecutionDuration" class="form-control" min="0" max="86400000" ng-minlength="0" ng-maxlength="8">
                                </div>
                            </div>
                        </div>

                        <div class="row" ng-if="vm.advancedFiltersAreShown">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("Action")</label>
                                    <input type="text" class="form-control" ng-model="vm.requestParams.methodName">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("ErrorState")</label>
                                    <select class="form-control" ng-model="vm.requestParams.hasException">
                                        <option value="">@L("All")</option>
                                        <option value="false">@L("Success")</option>
                                        <option value="true">@L("HasError")</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="row" ng-if="vm.advancedFiltersAreShown">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">@L("Browser")</label>
                                    <input type="text" class="form-control" ng-model="vm.requestParams.browserInfo">
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">

                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="row margin-bottom-10">
                        <div class="col-sm-6">
                            <span class="clickable-item text-muted" ng-if="!vm.advancedFiltersAreShown" ng-click="vm.advancedFiltersAreShown=!vm.advancedFiltersAreShown"><i class="fa fa-angle-down"></i> @L("ShowAdvancedFilters")</span>
                            <span class="clickable-item text-muted" ng-if="vm.advancedFiltersAreShown" ng-click="vm.advancedFiltersAreShown=!vm.advancedFiltersAreShown"><i class="fa fa-angle-up"></i> @L("HideAdvancedFilters")</span>
                        </div>
                        <div class="col-sm-6 text-right">
                            <button class="btn btn-default" ng-click="vm.exportToExcel()"><i class="fa fa-file-excel-o"></i> @L("ExportToExcel")</button>
                            <button class="btn blue" ng-click="vm.getAuditLogs()"><i class=" fa fa-refresh"></i> @L("Refresh")</button>
                        </div>
                    </div>
                </form>
            </div>
            <div busy-if="vm.loading">
                <div ui-grid="vm.gridOptions" ui-grid-pagination ui-grid-resize-columns dir=@(CultureHelper.IsRtl ? "rtl" : "")></div>
            </div>
        </div>
    </div>
</div>